<?php

require_once ('Zend/Form.php');

/**
 * Enter description here...
 *
 */
class EventForm extends Zend_Form {
	
	public function init() {
		
		// Dojo-enable the form:        
		Zend_Dojo::enableForm ( $this );

		$this->setAction ( $this->getView()->url() )->setMethod ( 'post' );
		
		// Create and configure title element:
		$title = $this->createElement ( 'ValidationTextBox', 'title', 
			array( 
				'label'    => 'Title',	
				'stringLength' => '6',  
				'required' => true) );
		$title->addValidator ( 'stringLength', false, array (3, 50 ) )->setRequired ( true );
		
		// Create and configure link element:
		$link = $this->createElement ( 'TextBox', 'link' );
		$link->setLabel ( 'Link' );
		
		// Create and configure description element:
		$description = $this->createElement ( 'Textarea', 'description', 
				array(
				        'label'    => 'Description',
				        'style'    => 'width: 200px;height: 100px',
				    )
		);
		
		// Create and configure password element:
		$start = $this->createElement ( 'DateTextBox',     'start',     
			array('required'       => true, 
				  'invalidMessage' => 'Invalid date specified.',        
				  'formatLength'   => 'long')
			);
		$start->setLabel ( 'Date' );
		$start->addValidator ( 'Date', false )->setRequired ( true );
		
		// Create and configure password element:
		$status = $this->createElement ('ComboBox', 'status',     
			array('label' => 'Status',
			'value'        => 'planned',
			'storeId'     => 'stateStore', 
			'storeType'   => 'dojo.data.ItemFileReadStore',
			'storeParams' => array('url' => $this->getView()->url(array('action' => 'status')) ) ));
		$status->setRequired(true);
		
		$submit = $this->createElement('SubmitButton', 'submit1', array ('label' => 'Submit' ));
		$submitAndNew = $this->createElement('SubmitButton', 'submit2', array ('label' => 'Submit and New' ));
				

		// Add elements to form:
		// use addElement() as a factory to create 'Login' button:
		$this->addElements ( array ($title, $link, $description, $start, $status, $submit, $submitAndNew ) );
	
	}

}

?>